<template>
	<view class="wh p10">
		<view class="tac p-35-0 f18 mb10 c0">
			选择你要登录的店铺
		</view>
		<view class="bf p-15-10 dfbc mb10 bs6" v-for="(item,index) in list" :key="index" @click="toHome(item)">
			<view class="dfbc">
				<u-avatar :src="item.applyImage" size="50" shape="circle"></u-avatar>
				<view class="pl10">
					<view class="mb5 c0 wei6 f14">{{item.applyName}}</view>
					<view class="c9 f12">到期时间：{{item.endTime}}</view>
				</view>
			</view>
			<u-icon size="18" color="#ddd" name="arrow-right" style="line-height: 56rpx;"></u-icon>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations
	} from 'vuex'
	export default {
		data() {
			return {
				list: []
			}
		},
		async onLoad() {
			this.setStoreId('')
			this.fetchData()
		},
		onPullDownRefresh() {
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1000)
		},
		methods: {
			...mapMutations(["setStoreInfo", "setStoreId"]),
			async fetchData() {
				const {
					data: {
						list,
						total
					},
				} = await this.beg.request({
					url: this.api.applyList,
					data: {
						pageSize: 999
					},
				})
				this.list = list
				this.total = total;
			},
			toHome(v) {
				this.setStoreInfo(v)
				uni.navigateTo({
					url: '/pages/login/selectShop'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>